<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <title>业务数据探查 - TurboDX AI</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
    <link rel="stylesheet" href="styles/theme.css">
    <link rel="stylesheet" href="styles/toolbar.css">
    <style>
        body {
            margin: 0;
            padding: 20px;
            min-height: 100vh;
            font-family: Arial, sans-serif;
        }

        .container {
            max-width: 1200px;
            margin: 0 auto;
            padding: 0 48px;
        }

        .page-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
            padding: 16px 24px;
            background: white;
            border-radius: 12px;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        }

        .page-title {
            font-size: 24px;
            color: #1e88e5;
            margin: 0;
        }

        .back-btn {
            padding: 8px 20px;
            background: #1e88e5;
            color: white;
            border: none;
            border-radius: 6px;
            text-decoration: none;
            display: flex;
            align-items: center;
            gap: 8px;
            transition: all 0.3s;
        }

        .back-btn:hover {
            background: #1976d2;
            transform: translateY(-2px);
        }

        .main-content {
            display: grid;
            grid-template-columns: 400px 1fr;
            gap: 48px;
            margin-top: 24px;
        }

        .search-panel {
            background: white;
            border-radius: 12px;
            padding: 24px;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        }

        .search-title {
            font-size: 18px;
            color: #333;
            margin: 0 0 12px 0;
        }

        .search-description {
            color: #666;
            font-size: 14px;
            line-height: 1.5;
            margin-bottom: 20px;
        }

        .form-group {
            margin-bottom: 20px;
        }

        .form-label {
            display: block;
            margin-bottom: 8px;
            font-size: 14px;
            color: #333;
        }

        .select-wrapper {
            position: relative;
            width: 100%;
        }

        .select-wrapper select {
            width: 100%;
            height: 36px;
            padding: 0 12px;
            border: 1px solid #e0e0e0;
            border-radius: 6px;
            font-size: 14px;
            background: #fff;
            appearance: none;
            cursor: pointer;
        }

        .radio-group {
            display: flex;
            flex-direction: column;
            gap: 12px;
        }

        .radio-grid {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 12px;
        }

        .radio-wrapper {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 8px 12px;
            border-radius: 4px;
            cursor: pointer;
        }

        .radio-wrapper:hover {
            background-color: var(--background-secondary);
        }

        .radio-wrapper input[type="radio"] {
            margin: 0;
            width: 16px;
            height: 16px;
        }

        .radio-wrapper label {
            font-size: 14px;
            color: #333;
            cursor: pointer;
        }

        .search-btn {
            width: 100%;
            height: 40px;
            background: #1e88e5;
            color: white;
            border: none;
            border-radius: 6px;
            font-size: 14px;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            cursor: pointer;
            transition: all 0.3s;
            margin-top: 20px;
        }

        .search-btn:hover {
            background: #1976d2;
        }

        .assistant-panel {
            background: white;
            border-radius: 12px;
            padding: 24px;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        }

        .ai-response {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            text-align: center;
            padding: 40px;
            margin-top: 20px;
        }

        .ai-icon {
            font-size: 48px;
            color: #1e88e5;
            margin-bottom: 20px;
        }

        .ai-message {
            font-size: 20px;
            color: #333;
            margin-bottom: 8px;
        }

        .ai-submessage {
            font-size: 14px;
            color: #666;
        }

        /* 添加关键字搜索样式 */
        .keyword-search {
            width: 100%;
            display: flex;
            gap: 8px;
            margin-bottom: 20px;
        }

        .keyword-search .search-input {
            flex: 1;
            height: 40px;
            padding: 0 12px;
            border: 1px solid #e0e0e0;
            border-radius: 6px;
            font-size: 14px;
            background: #fff;
            transition: all 0.3s;
            box-sizing: border-box;
        }

        .keyword-search .search-btn {
            width: auto;
            margin: 0;
            padding: 0 20px;
            height: 40px;
        }

        /* 添加分隔符样式 */
        .search-divider {
            display: flex;
            align-items: center;
            gap: 12px;
            color: #666;
            font-size: 14px;
            margin: 20px 0;
        }

        .search-divider::before,
        .search-divider::after {
            content: "";
            flex: 1;
            height: 1px;
            background: #e0e0e0;
        }

        /* 修改搜索表单样式 */
        .search-form {
            background: var(--background-secondary);
            padding: 20px;
            border-radius: 8px;
            width: 100%;
            box-sizing: border-box;
        }

        /* 修改按钮文字 */
        .search-form .search-btn {
            margin-top: 20px;
        }

        /* 修改 radio-group 部分的代码 */
        .radio-group {
            display: flex;
            flex-direction: column;
            gap: 12px;
        }

        .group-section {
            display: flex;
            flex-direction: column;
            gap: 12px;
        }

        .section-divider {
            height: 1px;
            background: #e0e0e0;
            margin: 16px 0;
        }

        .input-field {
            margin-left: 36px;
            margin-top: -4px;
            margin-bottom: 8px;
        }

        .input-field .search-input {
            width: calc(100% - 36px);
            height: 36px;
            padding: 0 12px;
            border: 1px solid #e0e0e0;
            border-radius: 6px;
            font-size: 14px;
            background: #fff;
            transition: all 0.3s;
        }

        .input-field .search-input:focus {
            border-color: #1e88e5;
            outline: none;
        }

        .radio-grid {
            display: flex;
            flex-wrap: wrap;
            gap: 12px;
        }

        .radio-grid .radio-wrapper {
            width: calc(50% - 6px);
        }

        .input-field {
            margin-top: 8px;
        }

        .input-field .search-input {
            width: 100%;
            height: 40px;
            padding: 0 12px;
            border: 1px solid #e0e0e0;
            border-radius: 6px;
            font-size: 14px;
            background: #fff;
            transition: all 0.3s;
            box-sizing: border-box;
        }

        .input-field .search-input:focus {
            border-color: #1e88e5;
            outline: none;
        }

        .radio-section {
            border: 1px solid #e0e0e0;
            border-radius: 8px;
            padding: 16px;
            background: #fff;
        }

        .radio-section .radio-wrapper {
            border: none;
            background: transparent;
            padding: 8px 0;
        }

        .radio-section .radio-wrapper:hover {
            background: var(--background-secondary);
            border-radius: 4px;
            padding: 8px 12px;
            margin: 0 -12px;
        }

        .radio-section .radio-wrapper:not(:last-child) {
            margin-bottom: 8px;
        }

        .radio-box {
            border: 1px solid #e0e0e0;
            border-radius: 8px;
            padding: 16px;
            background: #fff;
            margin-bottom: 16px;
        }

        .radio-box:last-child {
            margin-bottom: 0;
        }

        .radio-box .radio-wrapper {
            padding: 8px 0;
        }

        .radio-box .radio-wrapper:hover {
            background: var(--background-secondary);
            border-radius: 4px;
            padding: 8px 12px;
            margin: 0 -12px;
        }

        .radio-box .radio-wrapper:not(:last-child) {
            margin-bottom: 8px;
        }

        .radio-wrapper label {
            font-size: 14px;
            color: #333;
            cursor: pointer;
            line-height: 1.4;
            word-break: break-all;
        }

        .input-field {
            margin-left: 28px;
            margin-bottom: 12px;
        }

        /* 添加以下样式 */
        .bottom-input {
            margin-top: 16px;
            margin-left: 0;
            padding-top: 16px;
            border-top: 1px solid #e0e0e0;
        }

        .bottom-input .search-input {
            width: 100%;
        }

        /* 添加侧边栏样式 */
        .sidebar {
            position: fixed;
            right: 20px;
            top: 50%;
            transform: translateY(-50%);
            display: flex;
            flex-direction: column;
            gap: 12px;
            z-index: 1000;
            background: white;
            padding: 12px;
            border-radius: 8px;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        }

        .sidebar-item {
            width: 24px;
            height: 24px;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            color: #666;
            transition: all 0.3s;
        }

        .sidebar-item:hover {
            color: #1e88e5;
        }

        [data-theme="dark"] .sidebar {
            background: #333;
        }

        [data-theme="dark"] .sidebar-item {
            color: #999;
        }

        [data-theme="dark"] .sidebar-item:hover {
            color: #fff;
        }
    </style>
</head>

<body>
    <div class="container">
        <header class="page-header">
            <h1 class="page-title">业务数据探查</h1>
            <a href="dashboard.html" class="back-btn">
                <i class="fas fa-arrow-left"></i>
                返回首页
            </a>
        </header>

        <main class="main-content">
            <div class="search-panel">
                <h2 class="search-title">业务数据探查</h2>
                <p class="search-description">
                    在全部或指定范围内，寻找业务流程、业务环节、数据表、表字段等的相关信息。
                </p>

                <form class="search-form">
                    <div class="form-group">
                        <label class="form-label">搜索范围（不指定则为全部）：</label>
                        <div class="select-wrapper">
                            <select>
                                <option value="">数据所属部门</option>
                                <option value="dept1">部门一</option>
                                <option value="dept2">部门二</option>
                                <option value="dept3">部门三</option>
                            </select>
                        </div>
                    </div>

                    <div class="radio-group">
                        <div class="radio-box">
                            <div class="radio-wrapper">
                                <input type="radio" id="option1" name="searchType" checked>
                                <label for="option1">寻找全部业务流程信息（不含环节）</label>
                            </div>
                            <div class="radio-wrapper">
                                <input type="radio" id="option2" name="searchType">
                                <label for="option2">寻找全部业务环节</label>
                            </div>
                        </div>

                        <div class="radio-box">
                            <div class="radio-wrapper">
                                <input type="radio" id="option3" name="searchType">
                                <label for="option3">根据业务流程寻找其所含业务环节</label>
                            </div>
                            <div class="radio-wrapper">
                                <input type="radio" id="option4" name="searchType">
                                <label for="option4">根据业务环节寻找其相关数据表</label>
                            </div>
                            <div class="radio-wrapper">
                                <input type="radio" id="option5" name="searchType">
                                <label for="option5">根据数据表寻找其相关业务环节</label>
                            </div>
                            <div class="radio-wrapper">
                                <input type="radio" id="option6" name="searchType">
                                <label for="option6">寻找数据表的属性及所含字段</label>
                            </div>
                            <div class="input-field bottom-input">
                                <input type="text" placeholder="请输入搜索内容" class="search-input">
                            </div>
                        </div>
                    </div>

                    <button type="submit" class="search-btn">
                        <i class="fas fa-search"></i>
                        组合搜索
                    </button>
                </form>
            </div>

            <div class="assistant-panel">
                <div class="keyword-search">
                    <input type="text" class="search-input" placeholder="请输入关键词搜索...">
                    <button type="button" class="search-btn">
                        <i class="fas fa-search"></i>
                        搜索
                    </button>
                </div>

                <div class="ai-response">
                    <div class="ai-icon">
                        <i class="fas fa-robot"></i>
                    </div>
                    <div class="ai-message">Hi，我是您的AI助手</div>
                    <div class="ai-submessage">请输入关键词，我来帮您查找相关信息</div>
                </div>
            </div>
        </main>

        <!-- 添加侧边工具栏 -->
        <div class="sidebar">
            <div class="sidebar-item" id="themeToggle">
                <i class="fas fa-moon"></i>
            </div>
            <div class="sidebar-item" id="backToTop">
                <i class="fas fa-arrow-up"></i>
            </div>
            <div class="sidebar-item" id="helpCenter">
                <i class="fas fa-question-circle"></i>
            </div>
        </div>
    </div>

    <script src="scripts/toolbar.js"></script>
    <script>
        // 修改 script 部分的代码
        document.addEventListener('DOMContentLoaded', function () {
            initTheme();
            initToolbar();

            // 单选框交互效果
            document.querySelectorAll('.radio-wrapper').forEach(wrapper => {
                wrapper.addEventListener('click', function () {
                    const radio = this.querySelector('input[type="radio"]');
                    radio.checked = true;
                    // 手动触发 change 事件
                    radio.dispatchEvent(new Event('change'));
                });
            });

            // 修改事件监听代码
            function updatePlaceholders(radioId) {
                const bottomInput = document.querySelector('.bottom-input');
                const searchInput = bottomInput.querySelector('.search-input');
                const aiSearchInput = document.querySelector('.keyword-search .search-input');

                // 隐藏输入框
                bottomInput.style.display = 'none';

                // 根据选择显示相应的输入框并设置对应的placeholder
                if (['option3', 'option4', 'option5', 'option6'].includes(radioId)) {
                    bottomInput.style.display = 'block';

                    // 根据不同选项设置不同的placeholder
                    switch (radioId) {
                        case 'option3':
                            searchInput.placeholder = '请输入业务流程名称';
                            aiSearchInput.placeholder = '请输入业务流程名称...';
                            break;
                        case 'option4':
                            searchInput.placeholder = '请输入业务环节名称';
                            aiSearchInput.placeholder = '请输入业务环节名称...';
                            break;
                        case 'option5':
                            searchInput.placeholder = '请输入数据表名称';
                            aiSearchInput.placeholder = '请输入数据表名称...';
                            break;
                        case 'option6':
                            searchInput.placeholder = '请输入数据表名称';
                            aiSearchInput.placeholder = '请输入数据表名称...';
                            break;
                    }
                } else {
                    // 对于 option1 和 option2，只更新 AI 助手搜索框的提示
                    if (radioId === 'option1') {
                        aiSearchInput.placeholder = '请输入业务流程关键词...';
                    } else if (radioId === 'option2') {
                        aiSearchInput.placeholder = '请输入业务环节关键词...';
                    }
                }
            }

            // 添加 radio change 事件监听
            document.querySelectorAll('input[name="searchType"]').forEach(radio => {
                radio.addEventListener('change', function () {
                    updatePlaceholders(this.id);
                });
            });

            // 初始化时触发选中项的事件
            const checkedRadio = document.querySelector('input[name="searchType"]:checked');
            if (checkedRadio) {
                updatePlaceholders(checkedRadio.id);
            }
        });
    </script>
</body>

</html>